
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.UIManager;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Milton
 */
public class VentanaAdminSucursal extends javax.swing.JFrame implements ActionListener{

    /**
     * Creates new form VentanaAdminSucursal
     */
    public VentanaAdminSucursal(String tipo) {
        initComponents();
        
        switch(tipo){
            case "Modificar":
                configVentanaModificar();
                break;
            case "Crear":
                configVentanaCrear();
                break;
            case "Consultar":
                configVentanaConsulta();
                break;               
        }
        
        setControlador();
        this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    }

    public void setControlador(){
        botonAdmin.addActionListener(this);
        botonCancelar.addActionListener(this);
    }
    
    public void configVentanaModificar(){
        labelTitulo.setText("MODIFICAR SUCURSAL");
        botonAdmin.setText("Modificar");
        textIDSuc.setEditable(false);
    }
    
    public void configVentanaCrear(){
        labelTitulo.setText("CREAR SUCURSAL");
        botonAdmin.setText("Crear");
    }
    
    public void configVentanaConsulta(){
        labelTitulo.setText("CONSULTAR SUCURSAL");
        botonAdmin.setText("Continuar");
        textDireccion.setEditable(false);
        textIDSuc.setEditable(false);
        textNombre.setEditable(false);      
        textTelefono.setEditable(false);
        
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        labelTitulo = new javax.swing.JLabel();
        labelIDSuc = new javax.swing.JLabel();
        textIDSuc = new javax.swing.JTextField();
        labelNombre = new javax.swing.JLabel();
        textNombre = new javax.swing.JTextField();
        labelDireccion = new javax.swing.JLabel();
        textDireccion = new javax.swing.JTextField();
        labelTelefono = new javax.swing.JLabel();
        textTelefono = new javax.swing.JTextField();
        botonAdmin = new javax.swing.JButton();
        botonCancelar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        labelTitulo.setFont(new java.awt.Font("Consolas", 1, 18)); // NOI18N
        labelTitulo.setForeground(new java.awt.Color(0, 51, 102));
        labelTitulo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        labelTitulo.setText("ADMIN SUCURSAL");

        labelIDSuc.setFont(new java.awt.Font("Kalinga", 0, 14)); // NOI18N
        labelIDSuc.setForeground(new java.awt.Color(51, 102, 255));
        labelIDSuc.setText("ID Sucursal:");

        textIDSuc.setFont(new java.awt.Font("Kalinga", 0, 12)); // NOI18N

        labelNombre.setFont(new java.awt.Font("Kalinga", 0, 14)); // NOI18N
        labelNombre.setForeground(new java.awt.Color(51, 102, 255));
        labelNombre.setText("Nombre:");

        textNombre.setFont(new java.awt.Font("Kalinga", 0, 12)); // NOI18N

        labelDireccion.setFont(new java.awt.Font("Kalinga", 0, 14)); // NOI18N
        labelDireccion.setForeground(new java.awt.Color(51, 102, 255));
        labelDireccion.setText("Dirección:");

        textDireccion.setFont(new java.awt.Font("Kalinga", 0, 12)); // NOI18N

        labelTelefono.setFont(new java.awt.Font("Kalinga", 0, 14)); // NOI18N
        labelTelefono.setForeground(new java.awt.Color(51, 102, 255));
        labelTelefono.setText("Teléfono:");

        textTelefono.setFont(new java.awt.Font("Kalinga", 0, 12)); // NOI18N

        botonAdmin.setFont(new java.awt.Font("Trebuchet MS", 0, 14)); // NOI18N
        botonAdmin.setText("Admin");

        botonCancelar.setFont(new java.awt.Font("Trebuchet MS", 0, 14)); // NOI18N
        botonCancelar.setText("Cancelar");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(134, 134, 134)
                        .addComponent(labelTitulo))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(70, 70, 70)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(labelTelefono)
                                .addGap(70, 70, 70)
                                .addComponent(textTelefono, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(labelDireccion)
                                .addGap(64, 64, 64)
                                .addComponent(textDireccion, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(labelNombre)
                                .addGap(73, 73, 73)
                                .addComponent(textNombre, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(labelIDSuc)
                                .addGap(51, 51, 51)
                                .addComponent(textIDSuc, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE)))))
                .addGap(90, 90, 90))
            .addGroup(layout.createSequentialGroup()
                .addGap(86, 86, 86)
                .addComponent(botonAdmin)
                .addGap(56, 56, 56)
                .addComponent(botonCancelar)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labelTitulo)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelIDSuc)
                    .addComponent(textIDSuc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelNombre)
                    .addComponent(textNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelDireccion)
                    .addComponent(textDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelTelefono)
                    .addComponent(textTelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 36, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(botonAdmin)
                    .addComponent(botonCancelar))
                .addGap(28, 28, 28))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton botonAdmin;
    private javax.swing.JButton botonCancelar;
    private javax.swing.JLabel labelDireccion;
    private javax.swing.JLabel labelIDSuc;
    private javax.swing.JLabel labelNombre;
    private javax.swing.JLabel labelTelefono;
    private javax.swing.JLabel labelTitulo;
    private javax.swing.JTextField textDireccion;
    private javax.swing.JTextField textIDSuc;
    private javax.swing.JTextField textNombre;
    private javax.swing.JTextField textTelefono;
    // End of variables declaration//GEN-END:variables

    @Override
    public void actionPerformed(ActionEvent ae) {
        if(ae.getActionCommand().equals("Modificar")){
            JOptionPane.showMessageDialog(null, "Implementame! D:");
        }
        
        if(ae.getActionCommand().equals("Continuar")){
            JOptionPane.showMessageDialog(null, "Implementame! D:");
            this.dispose();
        }
        
        if(ae.getActionCommand().equals("Crear")){
            JOptionPane.showMessageDialog(null, "Implementame! D:");
        }
        
        if(ae.getActionCommand().equals("Cancelar")){
            this.dispose();
        }
    }
}
